package com.tuo51.childcare.domain.bize;

import com.tuo51.foudation.model.Domain;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * 月龄对应的操作，对应测评表的月单元格
 */

@Data
@Entity
@Table(name = "bize_sheet")
@EqualsAndHashCode(callSuper = true)
public class BizEvaluateSheet extends Domain{

    @Column(columnDefinition = "varchar(50) COMMENT '量表名字'", unique = true)
    private String sheetName;

    @Column(name = "description", columnDefinition = "varchar(500) COMMENT '量表描述' ")
    private String description;

    @Column(name = "manual", columnDefinition = "varchar(500) COMMENT '操作手册' ")
    private String manual;

    @Column(columnDefinition = "int default 0 COMMENT '适用最小月龄'")
    private Integer month_min = 0;

    @Column(columnDefinition = "int default 0 COMMENT '适用最大月龄'")
    private Integer month_max = 0;

    enum PathPolicy{
        PB(0, "儿心量表算法"),
        SHOW_ALL(1, "出现所有"),
        ONE_BY_ONE(2, "一个一个出现");


        private PathPolicy(int code, String desc){
            this.code = code;
            this.desc = desc;
        }

        PathPolicy ofCode(int code){
             switch (code){
                case 0:
                    return PB;
                case 1:
                    return SHOW_ALL;
                case 2:
                    return ONE_BY_ONE;
                default:
                    return SHOW_ALL;
            }
        }

        public int getCode() {
            return code;
        }

        public String getDesc() {
            return desc;
        }

        int code;
        String desc;
    }

    @Column(columnDefinition = "int default 0 COMMENT '路径策略' ")
    private Integer pathPolicy;

    enum SheetType{
        FOR_PARENT(0, "家长用的"),
        FOR_CHILDREN(1, "小朋友");


        private SheetType(int code, String desc){
            this.code = code;
            this.desc = desc;
        }

        SheetType ofCode(int code){
            switch (code){
                case 0:
                    return FOR_PARENT;
                case 1:
                    return FOR_CHILDREN;
                default:
                    return FOR_PARENT;
            }
        }

        public int getCode() {
            return code;
        }

        public String getDesc() {
            return desc;
        }

        int code;
        String desc;
    }
    @Column(columnDefinition = "int default 0 COMMENT '路径策略' ")
    private Integer sheetType;

    @Column(columnDefinition = "int default 0 COMMENT '题目数量' ")
    private Integer questionCount = 0;

    @Column(columnDefinition = "int default 0 COMMENT '总分' ")
    private Integer maxScore = 0;

    @Column(columnDefinition = "int default 0 COMMENT '最低得分' ")
    private Integer minScore = 0;

    @Column(columnDefinition = "int default 0 COMMENT '渠道' ")
    private Integer channel = 0;

    @Column(columnDefinition = "int default 0 COMMENT '等级' ")
    private Integer level = 0;

    @Column(columnDefinition = "varchar(500) COMMENT '标签' ")
    private String tags;

    @Column(columnDefinition = "varchar(500) COMMENT '图标' ")
    private String icons;

    @Column(columnDefinition = "int default 0 COMMENT '等级' ")
    private Integer usedCount;
}
